import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import { getResponse } from 'utils/utils';
import { tenantRedirect } from "../services/tenantRedirectService";
export default {
  namespace: 'tenantRedirect',
  state: {
    tenantData: {},
    // 租户数据
    tenantDataDetail: {},
    // 租户明细数据
    pagination: {} // 分页参数

  },
  effects: {
    redirect: /*#__PURE__*/_regeneratorRuntime.mark(function redirect(_ref, _ref2) {
      var payload, call, response, tenantData;
      return _regeneratorRuntime.wrap(function redirect$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              payload = _ref.payload;
              call = _ref2.call;
              _context.next = 4;
              return call(tenantRedirect, payload);

            case 4:
              response = _context.sent;
              tenantData = getResponse(response);
              return _context.abrupt("return", tenantData);

            case 7:
            case "end":
              return _context.stop();
          }
        }
      }, redirect);
    })
  },
  reducers: {
    updateState: function updateState(state, action) {
      return _objectSpread(_objectSpread({}, state), action.payload);
    }
  }
};